const commonOm = {}

commonOm.listType = {
	game: "1",
	shop: "2"
}

commonOm.isNull = function(obj) {
	if (obj === null || obj === undefined) return true;
	let type = typeof obj;
	switch (type) {
		case 'object':
			return Object.keys(obj).length <= 0;
		case 'boolean':
			return !obj;
		case 'number':
			return obj === 0;
		case 'string':
			return obj === '';
		default:
			return true;
	}
}

commonOm.isTypeFunc = function(func) {
	return func && typeof func === 'function';
}

commonOm.showToast = function(showContent, showTime) {
	showTime = showTime || 2000;
	uni.showToast({
		title: showContent,
		duration: showTime
	});
}

commonOm.navigateTo = function(obj) {
	uni.navigateTo(obj);
}

commonOm.switchTab = function(obj) {
	uni.switchTab(obj);
}

export default commonOm
